{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Large Table Handling\n",
    "\n",
    "BeakerX table widget protects itself against tables with too many rows or columns. The interactive preview is not intended for large datasets.  Here's how these situations are handled.\n",
    "\n",
    "## Too Many Rows\n",
    "\n",
    "There is a limit of 100,000 rows.  Longer tables show a warning and an interactive preview of the first 10,000 rows.  The following cell shows what happens if you by accident return a million rows to the client."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "list = []\n",
    "for (i = 0; i< 1000*1000; i++) {\n",
    "  list << [sin:sin(i), cos:cos(i)]\n",
    "}\n",
    "list"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Too Many Columns\n",
    "\n",
    "There is a limit of 500 columns.  If there are more, then the extras are hidden and you get a UI to make your own column selection, with search."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "rowList = []\n",
    "for (row = 0; row < 100; row++) {\n",
    "    colMap = new LinkedHashMap();\n",
    "    for (col = 0 ; col < 700; col++) {\n",
    "      colMap.put('a' + col, row * col)\n",
    "    }\n",
    "    rowList << colMap\n",
    "}\n",
    "rowList"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Very Wide Cells\n",
    "\n",
    "The width of a cell is limited to 1000 characters. If a cell goes past that, it will be truncated with a '...' appended to the end."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "new TableDisplay(new CSV().read(\"../resources/data/long_lines.csv\"))"
   ]
  }
 ],
 "metadata": {
  "beakerx_kernel_parameters": {
   "classpath": [],
   "imports": [
    "com.twosigma.beakerx.easyform.EasyForm",
    "com.github.lwhite1.tablesaw.api.ml.regression.*",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.VimeoVideo",
    "static com.twosigma.beakerx.mimetype.FileLinkContainer.FileLinks",
    "com.twosigma.beakerx.chart.Color",
    "com.github.lwhite1.tablesaw.api.*",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.IFrame",
    "com.twosigma.beakerx.NamespaceClient",
    "com.twosigma.beakerx.chart.treemap.*",
    "com.twosigma.beakerx.jvm.object.OutputCell",
    "com.twosigma.beakerx.chart.treemap.util.*",
    "com.github.lwhite1.tablesaw.filtering.*",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.HTML",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.Javascript",
    "static com.twosigma.beakerx.mimetype.FileLinkContainer.FileLink",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.ScribdDocument",
    "static com.twosigma.beakerx.mimetype.SVGContainer.SVG",
    "com.twosigma.beakerx.mimetype.MIMEContainer",
    "net.sf.jtreemap.swing.*",
    "com.twosigma.beakerx.chart.histogram.*",
    "static com.github.lwhite1.tablesaw.api.QueryHelper.*",
    "com.twosigma.beakerx.chart.heatmap.HeatMap",
    "com.twosigma.beakerx.chart.xychart.*",
    "static com.twosigma.beakerx.mimetype.ImageContainer.Image",
    "com.github.lwhite1.tablesaw.api.ml.clustering.*",
    "com.twosigma.beakerx.chart.Filter",
    "static java.lang.Math.*",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.YoutubeVideo",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.Math",
    "com.twosigma.beakerx.fileloader.CsvPlotReader",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.Markdown",
    "java.util.concurrent.TimeUnit",
    "com.twosigma.beakerx.chart.categoryplot.plotitem.*",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.Video",
    "com.twosigma.beakerx.chart.categoryplot.*",
    "static com.twosigma.beakerx.mimetype.MIMEContainer.Latex",
    "com.twosigma.beakerx.chart.xychart.plotitem.*",
    "com.twosigma.beakerx.table.*",
    "com.twosigma.beakerx.chart.KeyboardCodes",
    "com.twosigma.beakerx.chart.GradientColor",
    "com.github.lwhite1.tablesaw.columns.*",
    "com.twosigma.beakerx.chart.legend.*",
    "com.github.lwhite1.tablesaw.reducing.*"
   ]
  },
  "kernelspec": {
   "display_name": "Groovy",
   "language": "groovy",
   "name": "groovy"
  },
  "language_info": {
   "codemirror_mode": "groovy",
   "file_extension": ".groovy",
   "mimetype": "",
   "name": "Groovy",
   "nbconverter_exporter": "",
   "version": "2.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
